Skip to content

chore(test): mutation-test the relay seam and the upload queue - #65

Merged
simonvanlierde merged 7 commits into
mainfrom
mutation-test-relay-queue
Oct 24, 2026
Merged

simonvanlierde merged 7 commits into
mainfrom
mutation-test-relay-queue

Conversation

@simonvanlierde

Copy link
Copy Markdown
Contributor

This adds mutation testing for r9cam_models, app/relay and app/delivery. Nothing graded the tests for the relay trust boundary, the one place where untrusted relay frames enter the app, and the first run left 3 surviving mutants in _normalize_relay_path: one that stripped whitespace, one that stripped trailing letters, and one that broke the root path.

  • mutmut 3.8.0 joins the test group, with a [tool.mutmut] table that mutates only app/delivery, app/relay and r9cam_models.
  • just mutation runs it. mutmut builds module names from file paths, so the recipe stages a copy with the package under src/ and runs mutmut there. It starts no database. Survivors go to reports/mutation/survivors.txt, one name per line in the same form as the baseline, so diff against it works.
  • New tests pin what _normalize_relay_path strips: only trailing slashes, / stays /, and /camera , /cameraX and /camera/X are still rejected. relay_command_is_allowed and _is_valid_image_id had no survivors.
  • tests/mutation-baseline.txt holds the 476 that are left (466 survived, 10 with no tests), recorded after the queue property tests from fix(queue): keep the upload queue under its byte cap and add property tests #61. Two equivalent mutants carry a reason; the rest are real gaps, accepted for now. mutmut numbers mutants by position in their function, so the header says to compare counts per function after an edit. There is no CI gate.

Tests: the new tests fail against each of the three surviving mutants applied by hand (6, 4 and 2 failures) and pass on the current code. just mutation exits 0 with 1416 mutants, 940 killed and 466 survived, none in the three target functions, and its survivor list matches the baseline exactly. just check passes (866 passed, 1 skipped, 95.0% coverage).

@codspeed

codspeed Bot commented Oct 23, 2026 •

Copy link
Copy Markdown

Merging this PR will not alter performance

1 warning

⚠️ 2 benchmarks are dominated by system calls

System calls cannot be simulated consistently and are left out of the measure. The reported value understates the real cost. Switch to the Walltime instrument to measure them.

Learn more about system calls

See affected benchmarks

✅ 10 untouched benchmarks


Comparing mutation-test-relay-queue (8d42da0) with main (a610544)

Open in CodSpeed

@codecov

codecov Bot commented Oct 23, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

simonvanlierde and others added 6 commits October 24, 2026 23:04
mutmut showed that no test pinned what _normalize_relay_path strips.
A mutant that stripped whitespace or letters, or that broke the root path, still passed.
These tests check that only trailing slashes go, and that near-miss suffixes stay rejected.

Signed-off-by: Simon van Lierde <90462640+simonvanlierde@users.noreply.github.com>
…queue

- I add mutmut 3.8.0 to the test group and a [tool.mutmut] table.
- I add a `just mutation` recipe. It stages a copy with r9cam_models under src/, so mutmut names modules the way the tests import them.
- Survivors go to reports/mutation/survivors.txt, and I commit the accepted ones as tests/mutation-baseline.txt.
- CONTRIBUTING.md lists the new recipe.

Signed-off-by: Simon van Lierde <90462640+simonvanlierde@users.noreply.github.com>
Signed-off-by: Simon van Lierde <90462640+simonvanlierde@users.noreply.github.com>
…mpare them

Signed-off-by: Simon van Lierde <90462640+simonvanlierde@users.noreply.github.com>
… tests

Signed-off-by: Simon van Lierde <90462640+simonvanlierde@users.noreply.github.com>
- fix the Hypothesis seed under mutmut, which also turns off its example database
- list only survived and untested mutants; a timeout means the tests caught it, and timeouts come and go under load
- have just mutation diff survivor counts per function against the baseline and fail on a change
- re-record the baseline without the two timeout mutants
- move mutmut to the dev group so the CodSpeed job does not install it
- remove .mutation/ and reports/ in just clean

Signed-off-by: Simon van Lierde <90462640+simonvanlierde@users.noreply.github.com>
@simonvanlierde
simonvanlierde force-pushed the mutation-test-relay-queue branch from cc29d19 to 87e5488 Compare October 24, 2026 23:05
@simonvanlierde
simonvanlierde merged commit 45b81fc into main Oct 24, 2026
15 checks passed
@simonvanlierde
simonvanlierde deleted the mutation-test-relay-queue branch October 24, 2026 23:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant